<template>
    <div>
        <h2>学生姓名：{{ studentName }}</h2>
        <h2>学生性别：{{ studentSex }}</h2>
        <h2>学生年龄：{{ myStudentAge }}</h2>
        <button @click="updateAge">点击对年龄+1</button>
        <hr>
        <h2 @click="alertMsgName">点击名字：{{ name }}，弹窗</h2>
    </div>
</template>

<script>
// 导入混入
import { mixin } from '../mixin.js'

export default {
  name: 'Student', // 组件名

  props: ['studentName', 'studentSex', 'studentAge'],
  // 接受的同时对数据：进行类型限制 + 默认值的指定 + 必要性的限制------不常用
  /* props: {
    studentName: {
      type: String,
      required: true
    },
    studentSex: {
      type: String,
      required: true
    },
    studentAge: {
      type: Number,
      default: 99
    }
  }, */
  data () {
    return {
      myStudentAge: this.studentAge,
      name: '嘿嘿嘿'
    }
  },
  methods: {
    updateAge () {
      this.myStudentAge++
    }
  },
  mixins: [mixin]
}
</script>
